import React from 'react'
import { Table } from 'antd'

const ResourceList = ({
  onSelectResourceRows,
  dataSource,
  selectedRowKeys
}) => {

  const columns = [
    {
      title: '资源名称',
      dataIndex: 'name',
      key: 'name',
      align: "left",
      width: 150
    }, {
      title: '资源URL',
      dataIndex: 'url',
      key: 'url',
      align: "left",
      width: 150
    }
  ];

  const rowSelection = {
    type: 'check',
    onChange: onSelectResourceRows,
    selectedRowKeys
  };

  return (
    <div>
      <Table
        pagination={false}
        dataSource={dataSource}
        columns={columns}
        rowKey={record => record.id}
        rowSelection={rowSelection}
        scroll={{ y: 410 }}
        size="small" />
    </div>
  )
};

export default ResourceList
